<%@ page import="fleet_management.Auction"%>
<script type="text/javascript">
$(document).ready(function() {
<%--document.getElementById('donationDiv').style.display="none";--%>
<%--document.getElementById('sellingDiv').style.display="none";--%>
var auctionTypee='${auctionInstance?.auctionType}';
if(auctionTypee==="Sell"){
	alert(auctionTypee);
	document.getElementById('sell').checked=true;
<%--	document.getElementById('sellingDiv').style.display="";--%>
}

if(auctionTypee==="Scrap"){
	alert(auctionType);
	document.getElementById('scrap').checked=true;
}

if(auctionTypee==="Donate"){
	alert(auctionType);
	document.getElementById('donate').checked=true;
<%--	document.getElementById('donationDiv').style.display="";--%>
}
});

<%--function showHideForm(id){--%>
<%--	if(id=='sellingDiv'){--%>
<%--		document.getElementById(id).style.display="";--%>
<%--		document.getElementById('donationDiv').style.display="none";--%>
<%--		}--%>
<%--	if(id=='donationDiv'){--%>
<%--		document.getElementById(id).style.display="";--%>
<%--		document.getElementById('sellingDiv').style.display="none";--%>
<%--	}--%>
<%--}--%>

</script>

<div class="fieldcontain">
	<label for="vehicleNumber">
		<g:message code="auction.vehicleNumber.label" default="Vehicle Number" />
		<span class="required-indicator">*</span>
	</label>
	<g:if test="${auctionInstance?.vehicleNumber}">
	<g:textField name="vehicleNumber"  
	value="${auctionInstance?.vehicleNumber}"/>
	</g:if>
	<g:select name="vehicleNumber" from="${vehicleList}"
	value="${auctionInstance?.vehicleNumber}"
	noSelection="['':'Select vehicle number']" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'auctionType', 'error')} ">
	<label for="auctionType"> <g:message
			code="auction.auctionType.label" default="Auction Type" />

	</label>
	<g:radio name="auctionType" id="scrap" value="Scrap" />
	&nbsp;&nbsp;Scrap&nbsp;&nbsp;
	<g:radio name="auctionType" id="sell" value="Sell"/>
	&nbsp;&nbsp;Sell&nbsp;&nbsp;
	<g:radio name="auctionType" id="donate" value="Donate"  />
	&nbsp;&nbsp;Donate&nbsp;&nbsp;
	
</div>
<div id="sellingDiv">
<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'sellingCost', 'error')} ">
	<label for="sellingCost"> <g:message
			code="auction.sellingCost.label" default="Selling Cost" />

	</label>
	<g:field type="number" name="sellingCost"
		value="${fieldValue(bean: auctionInstance, field: 'sellingCost')}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'overallStatus', 'error')} ">
	<label for="overallStatus"> <g:message
			code="auction.overallStatus.label" default="Overall Status" />

	</label>
	<g:textField name="overallStatus"
		value="${auctionInstance?.overallStatus}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'soldCompanyName', 'error')} ">
	<label for="soldCompanyName"> <g:message
			code="auction.soldCompanyName.label" default="Sold Company Name" />

	</label>
	<g:textField name="soldCompanyName"
		value="${auctionInstance?.soldCompanyName}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'soldCompanyAddress', 'error')} ">
	<label for="soldCompanyAddress"> <g:message
			code="auction.soldCompanyAddress.label"
			default="Sold Company Address" />

	</label>
	<g:textField name="soldCompanyAddress"
		value="${auctionInstance?.soldCompanyAddress}" />
</div>
</div>
<div id="donationDiv">
<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'partnerName', 'error')} ">
	<label for="partnerName"> <g:message
			code="auction.partnerName.label" default="Partner Name" />

	</label>
	<g:textField name="partnerName" value="${auctionInstance?.partnerName}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'partnerAddress', 'error')} ">
	<label for="partnerAddress"> <g:message
			code="auction.partnerAddress.label" default="Partner Address" />

	</label>
	<g:textField name="partnerAddress"
		value="${auctionInstance?.partnerAddress}" />
</div>

<div
	class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'purposeOfDonation', 'error')} ">
	<label for="purposeOfDonation"> <g:message
			code="auction.purposeOfDonation.label" default="Purpose Of Donation" />

	</label>
	<g:textField name="purposeOfDonation"
		value="${auctionInstance?.purposeOfDonation}" />
</div>
</div>


